<?php
  header ("Content-type: image/png");
  header ("Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0");
  header ("Pragma: no-cache");
  putenv ('GDFONTPATH=' . realpath('.'));
  
  require_once('../config.php');
  require_once('./funcs_img.php');
  
  $conn = @mysql_connect(DBHOST.':'.DBPORT, DBUSER, DBPASS);
  if(!$conn) empty_image('SQL Connection Error ...');
  if(!@mysql_select_db(DATABASE)) empty_image('SQL Database Error ...');
  @mysql_query('SELECT * FROM `'.TAB_SRC.'` LIMIT 1;') or empty_image('SQL Table Error ...');
  
  
  $get_id = $_GET['get'];
  if($_GET['get2'] != null)
    $texts = intval(addslashes($_GET['get2']));
  else
    $texts = 9;
  
  $sql_return = @mysql_query('SELECT * FROM `'.TAB_SRC.'` WHERE `id`='.addslashes($get_id).' AND `type`="SIGNATURE" LIMIT 1');
  $sql_data = @mysql_fetch_assoc($sql_return);
  
  if($sql_data['id'] != null) {
    $image = load_img('./../'.$sql_data['path']);
    
    if((!$image) || (!check_parameters_db_src($sql_data)))
      empty_image();
    
    draw_preview($image, $sql_data, $texts);
    
    imagepng($image);
    imagedestroy($image);
  } 
  else
    empty_image();  

  @mysql_close($conn);
?>